#include "Tcp.h"
#include <QLibrary>
#include "Sington.h"

Tcp::Tcp() :
    m_info(nullptr)
{

}

Tcp *Tcp::instance()
{
    return Sington<Tcp>::getInstance();
}

void Tcp::load(QQmlApplicationEngine *engine)
{
    QLibrary loader("/TcpEngine.dll");
    if (loader.load()) {
        GetPluginInfo getPluginInfo = (GetPluginInfo)loader.resolve("getPluginInfo");
        if (getPluginInfo) {
            m_info = getPluginInfo(engine);
            if (m_info)
            {
                emit loadComplete();
            }
        }
    }
}

QQmlComponent *Tcp::getBtnComponent()
{
    return m_info->m_chiBtn;
}

QQmlComponent *Tcp::getPageComponent()
{
    return m_info->m_subWin;
}
